//
//  ClusterChatSource.h
//  HiQ
//
//  Created by arvintan on 12-8-9.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ClusterObjects.h"
#import "ClusterChatSourceDelegate.h"

#pragma pack(1)
// 在之前先发送groupID
typedef struct
{
    NSUInteger error;
    NSUInteger count;
    NSUInteger memberIDLen;
    NSUInteger memberNameLen;
    NSUInteger memberImageLen;
    NSUInteger memberStatusLen;
    NSUInteger memberListenPortLen; 
    NSUInteger memberIpLen;        
}CLUSTERMEMBERLISTREPLYHRD;
#pragma pack()

#define GROUP_REQUEST_NO_ERROR      0
#define GROUP_REQUEST_SQL_ERROR     1

@interface ClusterChatSource : NSObject<NSTableViewDataSource,NSTableViewDelegate>

@property (nonatomic,strong) Cluster *_cluster;
@property (nonatomic,strong) id<ClusterChatSourceDelegate> _delegate;

-(id) initWithCluster:(Cluster *) cluster;
-(void) onGetClusterMember;
-(void) onReceiveClusterMemberPacket:(NSData*) data;

-(void) onSendChatMsg:(NSString*) msg Name:(NSString*)name;
-(void) onreceiveChatMsg:(NSString *)msg Name:(NSString*)name;

@end
